package cn.usts.edu.lesson06;

import javax.swing.*;
import java.awt.*;

public class JComboBoxDemo03 extends JFrame {
    public JComboBoxDemo03() {
        this.setBounds(100,100,500,500);
        this.setVisible(true);
        this.setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);

        // 文本框
        JTextField field01 = new JTextField();
        field01.setToolTipText("text01");
        JTextField field02 = new JTextField();
        field02.setToolTipText("text02");

        // 密码框
        JPasswordField passwordField01 = new JPasswordField();
        passwordField01.setToolTipText("password01");
        passwordField01.setEchoChar('*');// 设置显示的内容
        JPasswordField passwordField02 = new JPasswordField();
        passwordField02.setEchoChar('x');// 设置显示的内容
        passwordField02.setToolTipText("password02");

        // 文本域
        JTextArea textArea = new JTextArea();
        JScrollPane scrollPane = new JScrollPane(textArea);
        //scrollPane.setToolTipText("文本域");

        // 布局
        Panel panel = new Panel(new GridLayout(3,2,20,20));
        panel.add(field01);
        panel.add(field02);
        panel.add(passwordField01);
        panel.add(passwordField02);
        panel.add(scrollPane);
        this.add(panel);
    }

    public static void main(String[] args) {
        new JComboBoxDemo03();
    }
}
